<template>
  <div class="elm-edit f_edit">
    <elm-page-bb class="ei_edit" v-loading="loading">
      <el-row style="text-align: right;height: 35px;padding: 3px;">
        <elm-open-button url="flow_param_edit" :full="false" width="600" height="300" icon="el-icon-edit" size="mini"
                         :data="{'edit_type':'create','flow_model':model}" :disabled="loading"
                         title="流程参数">新增参数</elm-open-button>
      </el-row>
      <el-row style="display: flex;height: 100%;width: 100%;">
        <elm-table :data='paramList' :stripe='true' :border='true' size='mini' :page-size="9999" height="100%">
          <el-table-column prop="param_name" label="参数名称" min-width="100px" header-align="center"></el-table-column>
          <el-table-column prop="param_value" label="默认值" width="80px" align="center"></el-table-column>
          <el-table-column prop="param_explain" label="备注" width="60px" header-align="center"></el-table-column>
          <el-table-column label="操作" width="160px" fixed="right" align="center">
            <template slot-scope="scope">
              <elm-open-button url="flow_param_edit" :full="false" width="700" height="450" type="text" size="mini"
                               :data="{'model':scope.row,'flow_model':model}" title="流程参数">
                编辑</elm-open-button>
              <el-button @click="v_deleteParam(scope.row)" type="text" size="mini" >
                删除</el-button>
            </template>
          </el-table-column>
        </elm-table>
      </el-row>


      <template #bottom>
        <el-button size="small" @click="close">取消</el-button>
      </template>
    </elm-page-bb>
  </div>
</template>

<script>
export default {
  extends: elmVueBase,
  data() {
    return {
      loading:true,

      DE_INFO: null,

      model: {},

      paramList:[],
    }
  },
  mounted() {

    this.DE_INFO = elm.dialog.request;
    this.model = this.DE_INFO.model;

    this.v_getData();
  },
  methods: {
    v_getData:function (){
      this.loading = true;
      this.v_getParamList();
    },
    async v_getParamList(){
      this.loading = true;
      //查找并组装节点数据
      let paramList = await elm.post('/system/login/flow/GetFlowParamList', { "flow_id": this.model.id});
      this.paramList = paramList;
      this.loading = false;

    },
    async v_deleteParam(data){
      await elm.delete('/system/login/flow/DeleteParam', {'id':data.id});
      this.v_getParamList();
    },

    v_cancle(){
      this.close();//extends: elmVueBase
    },

    em(s) {
      if (s == null || s == '') { return true; }
      else { return false; }
    },

  }
}
</script>
<style>
.f_edit .elm-body{padding: 5px;}
.f_edit .e_card_01 .el-card__body{height:calc(100% - 3px);}
</style>